export default {
    name: 'MixinPop',
    data() {
        return {
            posX: 0,
            posY: 0
        }
    },
    computed: {
        PosX() {
            return this.$store.getters.popParams.posX
        },
        PosY() {
            return this.$store.getters.popParams.posY
        }
    },
    watch: {
        PosX(val) {
            this.$nextTick(() => {
                var div = document.getElementsByClassName('pop-wrap')[0]
                if (div) {
                    var divW = div.clientWidth
                    this.posX = val - divW / 2
                }
            })
        },
        PosY(val) {
            this.$nextTick(() => {
                var div = document.getElementsByClassName('pop-wrap')[0]
                if (div) {
                    var divH = div.clientHeight
                    if (val < divH) {
                        this.posY = val + 50 /** 如果点比较靠上，框显示在点下面*/
                    } else {
                        this.posY = val - divH - 10
                    }
                }
            })
        }
    }
}

